<template>
  <div>
    <el-dialog
      title="删除仓库"
      :visible.sync="visible"
      :modal-append-to-body="false"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      @close="closeDialog"
      
      width="500px"
    >
      <div class="notify">
        <p>
          <strong>注意：</strong>
          <br />该行为可能要丢失该相关重要的数据
        </p>
      </div>
      <p>
        你确定要删除
        <strong>{{form.name}}</strong>
        吗？
      </p>

      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取 消</el-button>
        <el-button type="primary" @click="Submit()">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    form: {
      style: Object
    }
  },
  data() {
    return {
      submit: {},
      visible: true
    };
  },
  methods: {
    Submit() {
      this.$http
        .post("/store/delete", { id: this.form.id })
        .then(response => {
          if (response.data == "success") {
            this.$message({
              message: "删除完成",
              type: "success"
            });
            this.NeedRefresh();
            this.visible = false;
          } 
        });
    },
    closeDialog() {
      this.$emit("dialog-close");
    },
    NeedRefresh() {
      this.$emit("refresh");
    }
  }
};
</script>

<style>
</style>